import { GetServerSideProps, NextPage, PageConfig } from 'next';
import Head from 'next/head';
import React, { useEffect, useState } from 'react';
import { tbteacherlist } from '../../../atoms/db';
import Conteat from './conteat';

interface IProps {
	data: ITbteacherlist
}
/**
 * 教学管理
 */
const Page: NextPage<IProps> = ({ data }) => {
	return (
		<>
			<Head>
				<title>教师管理</title>
			</Head>
			<Conteat data={data} />
		</>
	);
};

export const config: PageConfig = {
	amp: false
};

export default Page;
// pre-render this page on each request
export const getServerSideProps: GetServerSideProps<IProps> = async (context) => {
	const id = context.query.id as string;
	const data = await tbteacherlist()
		.first('*')
		.where({
			teacher_id: id
		});
	return {
		props: {
			data
		}
	};
};


